package com.zzzzzz.account.signup;

import java.util.Date;

import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import com.zzzzzz.account.user.User;
import com.zzzzzz.core.validation.Confirm;

@Confirm(field="password")
public class SignupForm {

	@Email
	private String email;

	@NotBlank
	private String username;

	@Size(min=6, max=20)
	private String password;

	@Size(min=6, max=20)
	private String confirmPassword;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

	public void updateUser(User user){
		user.setEmail(getEmail());
		user.setUsername(getUsername());
		user.setPassword(getPassword());
		
		Date now = new Date();
		user.setCreateDate(now);
	}
}
